
const Sequelize = require('sequelize');

module.exports = (sequelize, DataTypes) => {
  const Article = sequelize.define('Article', {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      autoIncrement: true,
      comment: '主键'
    },
    user_id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: '用户id'
    },
    title: {
      type: DataTypes.STRING,
      comment: '标题'
    },
    content: {
      type: DataTypes.STRING,
      comment: '内容'
    },
    createTime: {
      type: DataTypes.DATE,
      defaultValue: Sequelize.literal('NOW()'),
      comment: '创建时间'
    }
  }, {
    timestamps: false
  });

  return Article
}